#/*************************************************************************
#    > File Name: Class_Dir.py
#    > Author: Yan Wang
#    > Mail: wangyan@imnu.edu.cn
#    > Created Time: Wed 30 Nov 2022 09:22:45 PM CST
# ************************************************************************/
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Library import *

class Dir(object):
    Param_Dir={}
    Param_Node={}
    cluster=""
    name=""

    def __init__(self,cluster,name):
        self.cluster=cluster
        self.name=name

    def Dir(self):
        return(self.Param_Dir)

    def Node(self):
        return(self.Param_Node)

    def Set_Work_Param(self):
        if self.cluster== "college":
            self.Param_Dir["code"]="/public/home/yancy/Code/Git/auto_mab/"
            self.Param_Dir["example"]=self.Param_Dir["code"]+"Examples/"
            self.Param_Dir["work"]=self.Param_Dir["code"]+"Lib/calc/"
            self.Param_Dir["data"]=self.Param_Dir["code"]+"Data/"
            self.Param_Dir["Software"]="/public/home/yancy/Software/"
            self.Param_Node["node_name"]=["node1","node2", "node3","node4","node5","node6","node7","node8","node9","node10","node11","node12"]
            self.Param_Node["core_num"]=[8,24,48,48]
            self.Param_Dir["MG"]=self.Param_Dir["Software"]+"MG5/"


        elif self.cluster== "yancy":
            self.Param_Dir["code"]="/home/yancy/Software/ARCH_test/Auto_Running/auto_mab/"
            self.Param_Dir["example"]=self.Param_Dir["code"]+"Examples/"
            self.Param_Dir["work"]=self.Param_Dir["code"]+"Lib/calc/"
            self.Param_Dir["data"]=self.Param_Dir["code"]+"Data/"
            self.Param_Dir["Software"]="/home/yancy/Software/"
            self.Param_Node["node_name"]=["node1", "node2","gpu"]
            self.Param_Node["core_num"]=[8,24,48,48]
            self.Param_Dir["MG"]=self.Param_Dir["Software"]+"MG5/"

        elif self.cluster == "PC":
            self.Param_Dir["code"]="/home/yancywww/Code/Workplace/auto_mab/"
            self.Param_Dir["example"]=self.Param_Dir["code"]+"Examples/"
            self.Param_Dir["work"]=self.Param_Dir["code"]+"calc/"
            self.Param_Dir["data"]=self.Param_Dir["code"]+"Data/"
            self.Param_Dir["Software"]="/home/yancywww/Software/bin/"
            self.Param_Node["node_name"]=["mynode"]
            self.Param_Node["core_num"]=[24]
            self.Param_Dir["MG"]=self.Param_Dir["Software"]+"MG5_aMC_v3_5_3/"

        self.Param_Dir["Delphes"]=self.Param_Dir["MG"]+"Delphes"
        sys.path.append(self.Param_Dir["Delphes"])        
        ROOT.gSystem.Load("libDelphes")

        self.Param_Node["node_num"]=len(self.Param_Node["node_name"]) 


        #self.Param_Dir["ARCH_template"]=self.Param_Dir["example"]+"test_input/control_ARCH"
        self.Param_Dir["ARCH_template"]=self.Param_Dir["example"]+"test_input_{fprocess}/control_ARCH".format(fprocess=self.name)
        self.Param_Dir["ARCH"]=self.Param_Dir["code"]+"../ARCH_4f_4tau/"

        #self.Param_Dir["BASDA_template"]=self.Param_Dir["example"]+"test_input/control_BASDA"
        self.Param_Dir["BASDA_template"]=self.Param_Dir["example"]+"test_input_{fprocess}/control_BASDA".format(fprocess=self.name)
        self.Param_Dir["BASDA"]=self.Param_Dir["code"]+"../BASDA/"

        #self.Param_Dir["hotmap_template"]=self.Param_Dir["example"]+"test_input/hotmap.C"
        self.Param_Dir["hotmap_template"]=self.Param_Dir["example"]+"test_input_{fprocess}/hotmap.C".format(fprocess=self.name)

        self.Param_Dir["input_folder"]=self.Param_Dir["data"]+'input_{fprocess}/'.format(fprocess=self.name)
        self.Param_Dir["output_folder"]=self.Param_Dir["data"]+'output_{fprocess}/'.format(fprocess=self.name)
        self.Transfer_To_Path()
        return

    def Transfer_To_Path(self):
        for key in self.Param_Dir:
            self.Param_Dir[key]=Path(self.Param_Dir[key])

    def Print(self):
        print("\n Dir Content is")
        print("	cluster : ", self.cluster )
        print("	name: ", self.name)
        print("	code dir : ", self.Param_Dir["code"])
        print("	example dir : ", self.Param_Dir["example"])
        print("	work dir : ", self.Param_Dir["work"])
        print("	data dir : ", self.Param_Dir["data"])
        print("	Software dir : ", self.Param_Dir["Software"])
        print("	node_name dir : ", self.Param_Node["node_name"])
        print("	node_num : ", self.Param_Node["node_num"])
        print("	core_num : ", self.Param_Node["core_num"])
        print("")
        print("	MG dir : ", self.Param_Dir["MG"])
        print("	Delphes dir : ", self.Param_Dir["Delphes"])
        print("	ARCH_template dir : ", self.Param_Dir["ARCH_template"])
        print("	ARCH dir : ", self.Param_Dir["ARCH"])
        print("	BASDA_template dir : ", self.Param_Dir["BASDA_template"])
        print("	BASDA dir : ", self.Param_Dir["BASDA"])
        print("	input dir : ", self.Param_Dir["input_folder"])
        print("	output dir : ", self.Param_Dir["output_folder"])
        print("_"*50)





